{% set pypi_name = 'vmware-nsx' %}
{% set source = fetch_source('https://tarballs.openstack.org/vmware-nsx/vmware-nsx-master.tar.gz') %}
{% set upstream_version = upstream_version() %}
{% set rpm_release = '1' %}

Name:           {{ py2name(py_versions=['py3']) }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        VMware-NSX family of Neutron plugins
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/vmware-nsx
Source0:        {{ source|basename }}
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('pbr') }}
Requires:       {{ py3('PrettyTable') }}
Requires:       {{ py3('SQLAlchemy') }}
Requires:       {{ py3('decorator') }}
Requires:       {{ py3('eventlet') }}
Requires:       {{ py3('httplib2') }}
Requires:       {{ py3('mock') }}
Requires:       {{ py3('netaddr') }}
Requires:       {{ py3('python-openstackclient') }}
Requires:       {{ py3('osc-lib') }}
Requires:       {{ py3('oslo.concurrency') }}
Requires:       {{ py3('oslo.config') }}
Requires:       {{ py3('oslo.db') }}
Requires:       {{ py3('oslo.i18n') }}
Requires:       {{ py3('oslo.log') }}
Requires:       {{ py3('oslo.serialization') }}
Requires:       {{ py3('oslo.utils') }}
Requires:       {{ py3('six') }}
Requires:       {{ py3('stevedore') }}
Requires:       {{ py3('tenacity') }}
Requires:       {{ py3('vmware-nsxlib') }}
BuildArch:      noarch

%description
VMWare NSX plugins for the OpenStack Neutron component

%package -n python-vmware-nsx-doc
Summary:        Documentation for vmware-nsx
Group:          Documentation/HTML
BuildRequires:  fdupes
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('openstackdocstheme') }}

%description -n python-vmware-nsx-doc
VMWare NSX plugins for the OpenStack Neutron component
This package contains the documentation

%prep
%autosetup -p1 -n {{ pypi_name }}-{{ upstream_version }}
%py_req_cleanup

%build
%{py3_build}
# generate html docs
PBR_VERSION={{ upstream_version }} %sphinx_build -b html doc/source doc/build/html
# remove the sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}
%fdupes doc/build/html/

%install
%{py3_install}

%files
%license LICENSE
%{python3_sitelib}/vmware_nsx
%{python3_sitelib}/*.egg-info
%{_bindir}/neutron-check-nsx-config
%{_bindir}/nsxadmin
%{_bindir}/nsx-migration

%files -n python-vmware-nsx-doc
%license LICENSE
%doc README.rst doc/build/html

%changelog
